<div class="coupon">
	<div class="nav">
		<div class="nav-li focus">优惠码</div>
	</div>
	<hr />
	<div class="box">
		<div class="coupon-config">
			<br>
			<h3>创建新的优惠码</h3>
			<br>
			<div class="title">标题：<input type="text" class="android" value="{{$Cache.bus.new_coupon.name}}" bind-input="{{'$Cache.bus.new_coupon.name'}}"></div>
			<br>
			<div class="title">
				<label for="">折扣：</label>
				<inputNumber value="{{$Cache.bus.new_coupon.config.discount*100}}" event-change="{{'$Event.bus.new_coupon.config.disc_m_100'}}" min="0" max="99.99" loop="1" fixed=2></inputNumber>
				<i>%。示例：输入90即为以90%的价格出售，即若购买100元的商品将以90元成交</i>
			</div>
			<button event-click="{{'$Event.bus.coupon.add'}}">生成优惠码</button>
		</div>
		<br>
		<hr>
		<br>
		<div class="coupon-list">
			<br>
			<h3>已有优惠码列表</h3>
			<br>
			<table class="metroui">
				<thead>
					<td>编号</td>
					<td>优惠码</td>
					<td>名称</td>
					<td>折扣</td>
					<td>创建时间</td>
					<td>操作</td>
				</thead>
				<tbody>
					{{#each $Cache.bus.coupon}}
					<tr>
						<td>{{$Index+1}}</td>
						<td>{{_id}}<copybutton event-aftercopy="{{'$Top.$Event.bus.coupon.copy_code'}}" value={{_id}}>复制</copybutton></td>
						<td>{{info.name}}</td>
						<td>{{#Fixed (10-info.config.discount*10),2}}折</td>
						<td>{{#Time create_time,'YYYY-MM-DD HH:mm:ss'}}</td>
						<td>
							<button event-click="{{'$Top.$Event.bus.coupon.remove'}}">删除</button>
						</td>
					</tr>
					{{/each}}
				</tbody>
			</table>
		</div>
	</div>
</div>